import { BaseApiService } from '../base/api.service';
import type { DepartmentTreeDTO } from '@/types/business/department';

/**
 * 部门服务类
 */
export class DepartmentService extends BaseApiService {
  constructor() {
    super('/api/engineer');
  }

  /**
   * 获取部门树结构
   */
  async getDepartmentTree(): Promise<DepartmentTreeDTO[]> {
    return this.get<DepartmentTreeDTO[]>('departments/tree');
  }

  /**
   * 获取部门详细信息
   */
  async getDepartmentInfo(deptId: string): Promise<DepartmentTreeDTO> {
    return this.get<DepartmentTreeDTO>(`departments/${deptId}`);
  }
}

// 导出单例实例
export const departmentService = new DepartmentService();
